package com.example.bausip;

import java.util.ArrayList;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class EventsListActivity extends Activity {

	Bundle extras;
	String dateValue;
	Activity currentActivity;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_eevents_list);
		currentActivity = this;
		extras = getIntent().getExtras();
		String value = "";
		if (extras != null) {
			dateValue = extras.getString("date");
			Toast.makeText(getApplicationContext(),dateValue  ,
					Toast.LENGTH_LONG).show();
			setTitle(dateValue);
		}
		fillListEvents();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.eevents_list, menu);
		return true;
	}

	public void fillListEvents() {
		final ListView myListView = (ListView) findViewById(R.id.list);
		// Defined Array values to show in ListView
		String[] values = new String[] { };
		ArrayList<String> myevents = MyStoredEvents.getEvents(dateValue);
		
		
		
		Log.d("ray","ray size: "+values.length);
		
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
				R.layout.my_row, R.id.myData, myevents);
		myListView.setAdapter(adapter);
		
	}

}
